package cn.ucox.web.ms;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableMBeanExport;
import org.springframework.jmx.support.RegistrationPolicy;

import javax.annotation.PreDestroy;

@SpringBootApplication
@EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING)
public class Application {

    private static DexBootstrap bootstrap;

    public static void main(String[] args) {
        SpringApplication application = new SpringApplication(Application.class);
        application.addListeners(new BootstrapListener());
        application.setRegisterShutdownHook(true);
        application.run(args);
    }

    @PreDestroy
    public void destroy() {
        bootstrap.stop();
    }
}
